package xin.nick.demo;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

//@Component
public class Producer02 implements CommandLineRunner {

    @Autowired
    private RabbitTemplate rabbitTemplate;
    private final String queueName = "spring-boot";
    private final String exchangeName = "spring-boot-exchange";

    @Override
    public void run(String... args) throws Exception {

        System.out.println("Sending message....");
        for(int i = 0; i < 1000; i++) {
            rabbitTemplate.convertAndSend(exchangeName,"","Hello");
        }

    }
}
